/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import java.util.Comparator;

/**
 *
 * @author Rossy
 */
//public class Historico implements Serializable,Comparable<Historico>{
public class Historico implements Comparable<Historico>{
    int id;
    int cant;
    Historico historico;

    public Historico() {
    }

    public Historico(int id, int cant) {
        this.id = id;
        this.cant = cant;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getCant() {
        return cant;
    }

    public void setCant(int cant) {
        this.cant = cant;
    }

    public Historico getHistorico() {
        return historico;
    }

    public void setHistorico(Historico historico) {
        this.historico = historico;
    }

    public int compareTo(Historico h)
    {
    if (this.cant==h.cant)
        return h.cant-this.cant;
    else
        return this.cant-h.cant;
    }
    
    public static Comparator<Historico> HistoricoVehiculosComparator = new Comparator<Historico>() {
    
        public int compare(Historico h1, Historico h2) {
        
        if (h1.cant==h2.cant){
            return h1.id-h2.id;
        }
        return h1.cant-h2.cant;
        }
    };
}